package view;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import org.jdesktop.application.Action;
import org.jdesktop.application.Application;
import org.jdesktop.application.ApplicationActionMap;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MozoBusqueda extends javax.swing.JPanel {
	private JLabel jLabelMozo;
	private AbstractAction abstractActionMozoBuscar;
	private JButton jButtonMozoCancelar;
	private JButton jButtonMozoBuscar;
	private JTextField jTextFieldMozoID;
	private JLabel jLabelMozoiD;
	private static MozoBusqueda panelMozoBusquedaInstancia;
	private MozoModificacion frameMozoModificacion;

	
	public static MozoBusqueda getInstancia(){
		if(panelMozoBusquedaInstancia==null){
			panelMozoBusquedaInstancia=new MozoBusqueda();
		}
		return panelMozoBusquedaInstancia;
	}
	
	public MozoBusqueda() {
		super();
		
		this.frameMozoModificacion=MozoModificacion.getInstancia();
		this.frameMozoModificacion.setVisible(false);

		
		initGUI();
	}
	
	private void initGUI() {
		try {
			{
				jLabelMozo = new JLabel();
				this.add(jLabelMozo);
				jLabelMozo.setText("Ingreso los datos del Mozo que desee modificar");
				jLabelMozo.setBounds(9, 8, 298, 14);
			}
			{
				jLabelMozoiD = new JLabel();
				this.add(jLabelMozoiD);
				jLabelMozoiD.setText("ID de Mozo: ");
				jLabelMozoiD.setBounds(83, 40, 84, 14);
			}
			{
				jTextFieldMozoID = new JTextField();
				this.add(jTextFieldMozoID);
				jTextFieldMozoID.setBounds(179, 37, 97, 21);
			}
			{
				jButtonMozoBuscar = new JButton();
				this.add(jButtonMozoBuscar);
				jButtonMozoBuscar.setText("Buscar");
				jButtonMozoBuscar.setBounds(83, 119, 84, 21);
				jButtonMozoBuscar.setAction(getAbstractActionMozoBuscar());
			}
			{
				jButtonMozoCancelar = new JButton();
				this.add(jButtonMozoCancelar);
				jButtonMozoCancelar.setText("Cancelar");
				jButtonMozoCancelar.setBounds(218, 119, 89, 21);
				jButtonMozoCancelar.setAction(getAppActionMap().get("actionCancelar"));
			}
			this.setSize(450, 172);
			this.setLayout(null);
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private AbstractAction getAbstractActionMozoBuscar() {
		if(abstractActionMozoBuscar == null) {
			abstractActionMozoBuscar = new AbstractAction("Buscar", null) {
				public void actionPerformed(ActionEvent evt) {
					//TODO
					frameMozoModificacion.setVisible(true);
					panelMozoBusquedaInstancia.setVisible(false);
				}
			};
		}
		return abstractActionMozoBuscar;
	}
	
	@Action
	public void actionCancelar() {
		panelMozoBusquedaInstancia.setVisible(false);
	}
	
    /**
    * Returns the action map used by this application.
     * Actions defined using the Action annotation
     * are returned by this method
     */
	private ApplicationActionMap getAppActionMap() {
		return Application.getInstance().getContext().getActionMap(this);
	}

}
